package it.marco.test.controller;

import it.marco.test.dm.Persona;
import it.marco.test.service.PersonaService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(value="/index")
public class IndexController {
	
	@Autowired
	private PersonaService<Persona, Long> serv;
	
	@RequestMapping(method=RequestMethod.GET)
	public String getIndex(ModelMap model){
		List<Persona> lp = serv.findAll();
		
		model.addAttribute("lista",lp);
		model.addAttribute("test2", "prova2");
		return "index";
//		return new ModelAndView("index","test", "Ciao a tutti");
	}
}
